const {
  defineConfig
} = require('@vue/cli-service')
const {
  VantResolver
} = require('unplugin-vue-components/resolvers');
const ComponentsPlugin = require('unplugin-vue-components/webpack');

module.exports = defineConfig({
  transpileDependencies: true,
  publicPath: './',
  // 配置开发服务器
  //去除生产环境的productionSourceMap
  productionSourceMap: false,
  devServer: {
    port: 8000,
    // 配置端口号
    open: true,
    // 配置服务器自动打开浏览器
    https: false,
    // 是否开启https协议
    host: 'localhost',
    //设置主机名
    proxy: {
      '/api': {
        target: 'http://xl.9yuecloud.com/api',
        changeOrigin: true, // 开启代理
        pathRewrite: { // 重写路径
          '^/api': ''
        }
      }
    }
  },
  configureWebpack: {
    plugins: [
      ComponentsPlugin({
        resolvers: [VantResolver()],
      }),
    ],
  },
})